
const tokens = {
  admin: {
    token: 'admin-token'
  },

  editor: {
    token: 'editor-token'
  }
}

const users = {
  'admin-token': {
    roles: [
      'admin'
    ],
    introduction: 'I am a super administrator',
    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
    name: 'Super Admin'
  },
  'editor-token': {
    roles: [
      'editor'
    ],
    introduction: 'I am an editor',
    avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
    name: 'Normal Editor'
  }
}

export default [
  // get user info
  {
    url: '/users/current',
    method: 'get',
    response: ({ query }) => {
      const { token } = query
      const info = users[
        token
      ]
      // mock error
      if (!info) {
        return {
          "status": 200,
          "message": "请求成功",
          "data": {
            "id": "1399e21b3b99bf78e45c9c00af72914f",
            "userName": "superadmin",
            "cellphone": "18958800299",
            "email": "",
            "realName": "超级管理员",
            "avatar": "",
            "lastLoginDate": 1629182792000,
            "status": 1,
            "createDate": 1619500034000,
            "userClassify": 0,
            "orderNum": 999,
            "post": null,
            "menus": [
              // {
              //   "id": "f6c968f09320eca847945b721c17b6e4",
              //   "name": "审批中心",
              //   "code": "approval-center",
              //   "parentId": "0",
              //   "status": 1,
              //   "orderNum": 1,
              //   "uri": "Layout",
              //   "path": "/approval-center",
              //   "redirect": "/approval-center/to-audit",
              //   "hidden": true,
              //   "keepAlive": false,
              //   "children": [
              //     {
              //       "id": "3d937cc90cf9c5997211728cf2df2571",
              //       "name": "待办",
              //       "code": "to-audit",
              //       "parentId": "f6c968f09320eca847945b721c17b6e4",
              //       "status": 1,
              //       "orderNum": 0,
              //       "uri": "approval-center/to-audit/index",
              //       "path": "to-audit",
              //       "redirect": "",
              //       "hidden": false,
              //       "keepAlive": false,
              //       "children": [
              //         {
              //           "id": "62cd5ffe85404160a1eaa0c166b4e77e",
              //           "name": "手写批示",
              //           "code": "plan-fabric",
              //           "parentId": "3d937cc90cf9c5997211728cf2df2571",
              //           "status": 1,
              //           "orderNum": 0,
              //           "uri": "approval-center/plan-fabric",
              //           "path": "/fabric",
              //           "redirect": "",
              //           "hidden": true,
              //           "keepAlive": false,
              //           "children": null
              //         }
              //       ]
              //     },
                  
              //   ]
              // }
            ],
            "orgRoleList": null,
            "userClassifyLabel": "超级管理员"
          }
        }
      }

      return {
        status: 200,

        data: info
      }
    }
  },
  // user login
  {
    url: '/security/login',

    method: 'post',
    response: ({ body }) => {
      return {
        status: 200,
        data: {
          token: 'fake-token',
          sysUser: {
            id: 'fake',
            userName: 'mocke people'
          }
        }
      }
    }
  },
  // user logout
  {
    url: '/api/user/logout',

    method: 'post',

    response: ({ body }) => {
      return {
        status: 200,
        data: 'success'
      }
    }
  }

]
